package cn.gson.fengboot.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "qpurchasecb", schema = "springboot", catalog = "")
public class QpurchasecbEntity {
    private int purchasecbId;
    private Integer prodetailId;//产品idprodetail_id
    private Integer purchasecbCgsl;//采购数量
    private QpurchaseEntity purchaseId;;//采购主表
    private Integer purchasecbCgdj;//采购小计


    @Column(name = "prodetail_id")
    public Integer getProdetailId() {
        return prodetailId;
    }

    public void setProdetailId(Integer prodetailId) {
        this.prodetailId = prodetailId;
    }

    @ManyToOne
    @JoinColumn(name = "purchase_id", referencedColumnName = "purchase_id")
    public QpurchaseEntity getPurchaseId() {
        return purchaseId;
    }

    public void setPurchaseId(QpurchaseEntity purchaseId) {
        this.purchaseId = purchaseId;
    }

    @Id
    @Column(name = "purchasecb_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getPurchasecbId() {
        return purchasecbId;
    }

    public void setPurchasecbId(int purchasecbId) {
        this.purchasecbId = purchasecbId;
    }


    @Basic
    @Column(name = "purchasecb_cgsl")
    public Integer getPurchasecbCgsl() {
        return purchasecbCgsl;
    }

    public void setPurchasecbCgsl(Integer purchasecbCgsl) {
        this.purchasecbCgsl = purchasecbCgsl;
    }

    @Basic
    @Column(name = "purchasecb_cgdj")
    public Integer getPurchasecbCgdj() {
        return purchasecbCgdj;
    }

    public void setPurchasecbCgdj(Integer purchasecbCgdj) {
        this.purchasecbCgdj = purchasecbCgdj;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        QpurchasecbEntity that = (QpurchasecbEntity) o;
        return purchasecbId == that.purchasecbId &&
                Objects.equals(purchaseId, that.purchaseId) &&
                Objects.equals(prodetailId, that.prodetailId) &&
                Objects.equals(purchasecbCgsl, that.purchasecbCgsl);
    }

    @Override
    public int hashCode() {
        return Objects.hash(purchasecbId, purchaseId, prodetailId, purchasecbCgsl);
    }
}
